import os
from API.currency import get_currency_historical_price
from utils import df_into_db


DATA_DIR = 'E:\\data'
PREMIUM_DATA_DIR = os.path.join(DATA_DIR, 'usdt_premium')

# 从新浪获取离岸人民币汇率的历史数据，直接获取全部数据，每日更新
print('更新离岸人民币汇率')
file_name = os.path.join(PREMIUM_DATA_DIR, 'usdcnh_exchange_rate.csv')
df = get_currency_historical_price(symbol='USDCNH')
# df.to_csv(file_name, index=False)
df_into_db(df, db_name="usdt_premium",table_name="usdcnh_exchange_rate")